package com.spring.controller;

import com.spring.config.interceptor.PassToken;
import com.spring.pojo.ValidatorBean;
import com.spring.utils.HibernateValidatorUtil;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TestCntroller {

    @PassToken
    @RequestMapping(value = "/validator", method = RequestMethod.GET)
    public ValidatorBean validator() {
        ValidatorBean bean = new ValidatorBean();
        bean.setName("hello");
        bean.setPhone("15919460849");
        bean.setEmail("1315011569@qq.com");
        boolean validator = HibernateValidatorUtil.validator(bean);
        return validator ? bean : new ValidatorBean();
    }
}
